package chapter003;

/**
 *  这个是文档注释, 对类/方法/常量等的说明
 *  JavaSE 第三章
 *  运算符
 *
 *  @author Jack魏
 */
public class Point05 {

    public static void main(String[] args) {
        int a = 10;
        int b = 20;

        // 算数运算
        System.out.println("a + b = " + (a + b));
        System.out.println("a - b = " + (a - b));
        System.out.println("a * b = " + (a * b));
        System.out.println("a / b = " + (a / b));
        System.out.println("a % b = " + (a % b));
        System.out.println("a++ = " + a++ + ", ++a = "+ ++a);
        System.out.println("a-- = " + a-- + ", --a = "+ --a);

        // 关系运算
        System.out.println("a == b  is  " + (a == b));
        System.out.println("a != b  is  " + (a != b));
        System.out.println("a > b  is  " + (a > b));
        System.out.println("a < b  is  " + (a < b));
        System.out.println("a >= b  is  " + (a >= b));
        System.out.println("a <= b  is  " + (a <= b));

        // 逻辑运算
        boolean flagA = true;
        boolean flagB = false;

        System.out.println("true && false  is  " + (flagA && flagB));
        System.out.println("true || false  is  " + (flagA || flagB));
        System.out.println("!true  is  " + (!flagA));

        // 位运算
        System.out.println("a 的二进制: " + Integer.toBinaryString(a));
        System.out.println("b 的二进制: " + Integer.toBinaryString(b));
        System.out.println("a & b  =  " + (a & b));
        System.out.println("a | b  =  " + (a | b));
        System.out.println("a ^ b  =  " + (a ^ b));
        System.out.println("~a  =  " + (~a));
        System.out.println("a << 2  =  " + (a <<2));
        System.out.println("a >> 2  =  " + (a >>2));
        System.out.println("a >>> 2 =  " + (a >>>2));
    }
}
